package com.itheima.dao;

import com.itheima.domain.Book;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author Xiao
 * @date 2021/9/15
 */
//TODO 添加@Mapper
@Mapper
public interface BookDao {
    @Insert("insert into tb_book values (null, #{TYPE}, #{NAME}, #{description})")
    int save(Book book);
    @Update("update tb_book set TYPE=#{TYPE}, NAME=#{NAME}, description=#{description} where id=#{id}")
    int update(Book book);
    @Delete("delete from tb_book where id=#{id}")
    int delete(Integer id);
    @Select("select * from tb_book where id=#{id}")
    Book selectById(Integer id);
    @Select("select * from tb_book")
    List<Book> selectAll();
}
